let http = require('http');

let users = [
    {id:1,nane:'sss'},
    {id:2,nane:'sjj'},
];

let server = http.createServer((req,res)=>{
    res.setHeader('Access-Control-Allow-Origin','*');

    if(req.url === '/api/users'){
        res.end(JSON.stringify(users));
    }else{
        res.end('Not found');
    }

});
server.listen(3000,()=>{
    console.log('后段api服务已启动在3000端口');
}) 